package com.gcsoftware.web.controller.admin;

import com.gcsoftware.web.service.T_COM_SYS_DICT_SERVICE;
import com.gcsoftware.web.service.T_GW_COMPANY_SERVICE;
import com.gcsoftware.web.service.T_GW_ROLE_SERVICE;
import com.gcsoftware.web.beans.T_COM_SYS_DICTITEM;
import com.gcsoftware.web.beans.T_GW_ROLES;
import com.gcsoftware.utils.SysConst;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by qs on 2018/3/22.
 */
@Controller
@RequestMapping("/manage")
public class ManagerController {

    @Autowired
    private T_GW_ROLE_SERVICE roleService;

    @Autowired
    private T_COM_SYS_DICT_SERVICE dictService;

    @Autowired
    private T_GW_COMPANY_SERVICE companyService;


    @RequestMapping(value = "/company")
    public String company() {
        return "admin/company";
    }

    @RequestMapping(value = "/account")
    public String account(Model model) {
        List<T_GW_ROLES> rolesList = roleService.queryForList("1",null);
        model.addAttribute("roleList",rolesList);

        List<T_COM_SYS_DICTITEM> userStatusList = dictService.queryForList(SysConst.DICT_GRP_USER_STATUS);
        model.addAttribute("userStatusList",userStatusList);

        model.addAttribute("companyList" , companyService.queryForList(null,null));

        return "admin/account";
    }
    @RequestMapping(value = "/logs")
    public String logs(Model model) {
        return "admin/logs";
    }
}
